package com.ys.entity.purchase;

import java.io.*;
import java.util.Date;
import javax.persistence.Table;
import com.alibaba.fastjson.annotation.JSONField;
import com.ys.annotation.YsField;
import com.ys.entity.base.BaseEntity;
/**
*/
@Table(name="TCG_PurchaseByPlan", catalog="Id")
public class TcgPurchaseByPlan extends BaseEntity<TcgPurchaseByPlan> implements Serializable {

	@YsField(nameDataBase="Id", nameJava="id", typeDataBase="bigint")
	private Long id;
	@YsField(nameDataBase="Bid", nameJava="bid", typeDataBase="varchar")
	private String bid;
	@YsField(nameDataBase="EffectStock", nameJava="effectStock", typeDataBase="bit")
	private Integer effectStock;
	@YsField(nameDataBase="CreateChangeId", nameJava="createChangeId", typeDataBase="bigint")
	private Long createChangeId;
	@YsField(nameDataBase="Vgsbm", nameJava="vgsbm", typeDataBase="varchar")
	private String vgsbm;
	@YsField(nameDataBase="PurchaseAddressId", nameJava="purchaseAddressId", typeDataBase="bigint")
	private Long purchaseAddressId;
	@YsField(nameDataBase="Remark", nameJava="remark", typeDataBase="varchar")
	private String remark;
	@YsField(nameDataBase="IsJgSub", nameJava="isJgSub", typeDataBase="tinyint")
	private Integer isJgSub;
	@YsField(nameDataBase="Status", nameJava="status", typeDataBase="tinyint")
	private Integer status;
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	@YsField(nameDataBase="CreateTime", nameJava="createTime", typeDataBase="datetime")
	private Date createTime;
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	@YsField(nameDataBase="UpdateTime", nameJava="updateTime", typeDataBase="datetime")
	private Date updateTime;

	public Long getId() {
		return id;
	}
	public TcgPurchaseByPlan setId(Long id) {
		this.id = id;
		return this;
	}
	public String getBid() {
		return bid;
	}
	public TcgPurchaseByPlan setBid(String bid) {
		this.bid = bid;
		return this;
	}
	public Integer getEffectStock() {
		return effectStock;
	}
	public TcgPurchaseByPlan setEffectStock(Integer effectStock) {
		this.effectStock = effectStock;
		return this;
	}
	public Long getCreateChangeId() {
		return createChangeId;
	}
	public TcgPurchaseByPlan setCreateChangeId(Long createChangeId) {
		this.createChangeId = createChangeId;
		return this;
	}
	public String getVgsbm() {
		return vgsbm;
	}
	public TcgPurchaseByPlan setVgsbm(String vgsbm) {
		this.vgsbm = vgsbm;
		return this;
	}
	public Long getPurchaseAddressId() {
		return purchaseAddressId;
	}
	public TcgPurchaseByPlan setPurchaseAddressId(Long purchaseAddressId) {
		this.purchaseAddressId = purchaseAddressId;
		return this;
	}
	public String getRemark() {
		return remark;
	}
	public TcgPurchaseByPlan setRemark(String remark) {
		this.remark = remark;
		return this;
	}
	public Integer getIsJgSub() {
		return isJgSub;
	}
	public TcgPurchaseByPlan setIsJgSub(Integer isJgSub) {
		this.isJgSub = isJgSub;
		return this;
	}
	public Integer getStatus() {
		return status;
	}
	public TcgPurchaseByPlan setStatus(Integer status) {
		this.status = status;
		return this;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public TcgPurchaseByPlan setCreateTime(Date createTime) {
		this.createTime = createTime;
		return this;
	}
	public Date getUpdateTime() {
		return updateTime;
	}
	public TcgPurchaseByPlan setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
		return this;
	}

	public static TcgPurchaseByPlan tcgPurchaseByPlan(
		String bid,
		Integer effectStock,
		Long createChangeId,
		String vgsbm,
		Long purchaseAddressId,
		String remark,
		Integer isJgSub,
		Integer status
			) {
		TcgPurchaseByPlan entity = new TcgPurchaseByPlan();
		entity.setBid(bid);
		entity.setEffectStock(effectStock);
		entity.setCreateChangeId(createChangeId);
		entity.setVgsbm(vgsbm);
		entity.setPurchaseAddressId(purchaseAddressId);
		entity.setRemark(remark);
		entity.setIsJgSub(isJgSub);
		entity.setStatus(status);
		return entity;
	}

	public TcgPurchaseByPlan copy() {
		try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
			 ObjectOutputStream out = new ObjectOutputStream(bos)) {
			out.writeObject(this);  // 序列化对象到输出流中
			ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
			ObjectInputStream in = new ObjectInputStream(bis);  // 从输入流中反序列化对象
			return (TcgPurchaseByPlan) in.readObject();  // 返回新的对象实例，它是原对象的深拷贝副本（如果是深拷贝的话）
		} catch (IOException | ClassNotFoundException e) {
			throw new RuntimeException(e);  // 处理异常情况
		}
	}
}